import java.util.*;


public class ArraysLesson {

	public static void main (String ARGC[])
	{ 

		
		//Create Array 1 with few values...
		int[] Arr1  = {10,30,50,60,100};
		
		// Find the largest Value in the arrays.
	//	int res = maxInArr(Arr1);
		
		//check if the array is Asc Sorted
		if(isAscSorted(Arr1))
			System.out.println("This array Is Asc Sorted");
		
		
		
		

	}
	

	
	/**
	 * Find the largest value in array
	 * @param arr
	 * @returns the largest value in the array
	 */
	public static int maxInArr (int[] arr)
	{
		
		int MAX_VALUE=arr[0];
		int POS=1;
		
		//iterate over the array v1
		for (int i=1;i!=arr.length;i++)
		{
			System.out.println("Iterating .. Val:" + arr[i]);
			if(arr[i] > MAX_VALUE )
			{
				MAX_VALUE = arr[i];
				POS = i+1;
			}
			
			// 1 4 9 10 22
			
			
		}
		
		return POS;
	}
	
	
	/**
	 * Check if the Given arrays is Sorted Asced
	 * @param arr
	 * @return
	 */
	public static boolean isAscSorted (int[] arr)
	{
		
		boolean isSorted = true;
		int i=0;
		while (i<arr.length-1 && isSorted)
		{
			if(arr[i] > arr[i+1])
				isSorted = false;
			i++;
		}
		
		return isSorted;
		
	}
	
	
}
